/**********************************************************************************************************
** 驱动文件：	other-CF12SD.c
** 驱动类型：	other
** 设备名称：	除湿机
** 设备型号：	CF12SD
** 设备品牌：	百奥
** 设备协议：	Modbus-RTU
** 驱动描述：	适用于百奥工商用除湿机
** 生成日期：	2019-10-18 17:19:49
**********************************************************************************************************/
#include "Includes.h"


/**********************************************************************************************************
* 定义设备数据点变量结构
**********************************************************************************************************/
typedef struct{
	Var OnOff;									//开/关机
	Var TimingSetting;							//定时设置
	Var TemperatureSetting;						//温度设定
	Var HumiditySetting;						//湿度设定
	Var RoomTemperature;						//环境温度
	Var RoomHumidity;							//环境湿度
	Var Fan;									//风机
	Var Compressor1;							//压缩机1
	Var Compressor2;							//压缩机2
	Var ElectricHeater;							//电加热
	Var LowFan;									//风机低
	Var HumidityControl;						//湿控状态
	Var Defrost;								//除霜状态
	Var Protect;								//保护
	Var DefrostSensor1;							//除霜传感器1
	Var DefrostSensor2;							//除霜传感器2
	Var DefrostSensor3;							//除霜传感器3
	Var DefrostSensor4;							//除霜传感器4
	Var HumiditySensor;							//湿度传感器
	Var PhaseSequenceFault;						//相序故障
	Var RoomTemperatureSensor;					//环境温度传感器
	Var SystemHighPressureSensor;				//系统高压传感器
	Var SystemLowPressureSensor;				//系统低压传感器
	Var FullWaterFault;							//满水故障
	Var CompressorOverCurrentFault;				//压缩机过流故障
	Var FanOverCurrentFault;					//风机过流故障
	Var DisplayBoardCommunication;				//显示板通讯
	Var PCFault;								//与PC机故障
	Var FireLineAndZeroLineReverse;				//火线与零线反接故障
	Var CoilTemperature1;						//盘管温度1
	Var CoilTemperature2;						//盘管温度2
	Var CoilTemperature3;						//盘管温度3
	Var CoilTemperature4;						//盘管温度4
	Var Reserve;								//预留
}Data_Struct;									//定义变量结构


/**********************************************************************************************************
* 设备数据点变量属性声明
**********************************************************************************************************/
const static Var_Property_Def var_attr[] = {
	{
		BOOLEAN,
		0,
		READWRITE,
		"OnOff",
		"开/关机",
		"",
		"开关机控制：0-关机，1-开机",
		0,
		0,
		"",
		"",
		0,
		0
	},
	{
		INTEGER,
		0,
		READWRITE,
		"TimingSetting",
		"定时设置",
		"",
		"定时设置：范围1-24小时，0表示取消定制，0xFFFF表示不更改",
		0,
		0,
		"",
		"",
		0,
		0
	},
	{
		FLOAT,
		0,
		READWRITE,
		"TemperatureSetting",
		"温度设定",
		"℃",
		"温度设定：范围10~65℃",
		0,
		0,
		"",
		"",
		0,
		0
	},
	{
		FLOAT,
		0,
		READWRITE,
		"HumiditySetting",
		"湿度设定",
		"%",
		"湿度设定：范围10~99%RH",
		0,
		0,
		"",
		"",
		0,
		0
	},
	{
		INTEGER,
		0,
		READONLY,
		"RoomTemperature",
		"环境温度",
		"℃",
		"环境温度：范围-127~127℃",
		0,
		0,
		"环境温度过高",
		"环境温度过低",
		0,
		0
	},
	{
		FLOAT,
		0,
		READONLY,
		"RoomHumidity",
		"环境湿度",
		"",
		"环境湿度：范围10~99%RH",
		0,
		0,
		"环境湿度过高",
		"环境湿度过低",
		0,
		0
	},
	{
		OCTSTR,
		0,
		READONLY,
		"Fan",
		"风机",
		"",
		"风机：0-关，1-开",
		0,
		0,
		"",
		"",
		0,
		0
	},
	{
		OCTSTR,
		0,
		READONLY,
		"Compressor1",
		"压缩机1",
		"",
		"压缩机1：0-关，1-开",
		0,
		0,
		"",
		"",
		0,
		0
	},
	{
		OCTSTR,
		0,
		READONLY,
		"Compressor2",
		"压缩机2",
		"",
		"压缩机2：0-关，1-开",
		0,
		0,
		"",
		"",
		0,
		0
	},
	{
		OCTSTR,
		0,
		READONLY,
		"ElectricHeater",
		"电加热",
		"",
		"电加热：0-关，1-开",
		0,
		0,
		"",
		"",
		0,
		0
	},
	{
		OCTSTR,
		0,
		READONLY,
		"LowFan",
		"风机低",
		"",
		"风机低：0-关，1-开",
		0,
		0,
		"",
		"",
		0.000,
		0.000
	},
	{
		OCTSTR,
		0,
		READONLY,
		"HumidityControl",
		"湿控状态",
		"",
		"湿控：0-关，1-开",
		0,
		0,
		"",
		"",
		0,
		0
	},
	{
		OCTSTR,
		0,
		READONLY,
		"Defrost",
		"除霜状态",
		"",
		"除霜状态：0-关，1-开",
		0,
		0,
		"",
		"",
		0,
		0
	},
	{
		OCTSTR,
		0,
		READONLY,
		"Protect",
		"保护",
		"",
		"保护：0-关，1-开",
		0,
		0,
		"",
		"",
		0,
		0
	},
	{
		OCTSTR,
		0,
		READONLY,
		"DefrostSensor1",
		"除霜传感器1",
		"",
		"除霜传感器1：0-正常，1-故障",
		0,
		0,
		"故障",
		"",
		0,
		0
	},
	{
		OCTSTR,
		0,
		READONLY,
		"DefrostSensor2",
		"除霜传感器2",
		"",
		"除霜传感器2：0-正常，1-故障",
		0,
		0,
		"故障",
		"",
		0,
		0
	},
	{
		OCTSTR,
		0,
		READONLY,
		"DefrostSensor3",
		"除霜传感器3",
		"",
		"除霜传感器3：0-正常，1-故障",
		0,
		0,
		"故障",
		"",
		0,
		0
	},
	{
		OCTSTR,
		0,
		READONLY,
		"DefrostSensor4",
		"除霜传感器4",
		"",
		"除霜传感器4：0-正常，1-故障",
		0,
		0,
		"故障",
		"",
		0,
		0
	},
	{
		OCTSTR,
		0,
		READONLY,
		"HumiditySensor",
		"湿度传感器",
		"",
		"湿度传感器：0-正常，1-故障",
		0,
		0,
		"故障",
		"",
		0,
		0
	},
	{
		OCTSTR,
		0,
		READONLY,
		"PhaseSequenceFault",
		"相序故障",
		"",
		"相序故障：0-正常，1-故障",
		0,
		0,
		"故障",
		"",
		0,
		0
	},
	{
		OCTSTR,
		0,
		READONLY,
		"RoomTemperatureSensor",
		"环境温度传感器",
		"",
		"环境温度传感器：0-正常，1-故障",
		0,
		0,
		"故障",
		"",
		0,
		0
	},
	{
		OCTSTR,
		0,
		READONLY,
		"SystemHighPressureSensor",
		"系统高压传感器",
		"",
		"系统高压传感器：0-正常，1-故障",
		0,
		0,
		"故障",
		"",
		0,
		0
	},
	{
		OCTSTR,
		0,
		READONLY,
		"SystemLowPressureSensor",
		"系统低压传感器",
		"",
		"系统低压传感器：0-正常，1-故障",
		0,
		0,
		"故障",
		"",
		0,
		0
	},
	{
		OCTSTR,
		0,
		READONLY,
		"FullWaterFault",
		"满水故障",
		"",
		"满水故障：0-正常，1-故障",
		0,
		0,
		"故障",
		"",
		0,
		0
	},
	{
		OCTSTR,
		0,
		READONLY,
		"CompressorOverCurrentFault",
		"压缩机过流故障",
		"",
		"压缩机过流故障：0-正常，1-故障",
		0,
		0,
		"故障",
		"",
		0,
		0
	},
	{
		OCTSTR,
		0,
		READONLY,
		"FanOverCurrentFault",
		"风机过流故障",
		"",
		"风机过流故障：0-正常，1-故障",
		0,
		0,
		"故障",
		"",
		0,
		0
	},
	{
		OCTSTR,
		0,
		READONLY,
		"DisplayBoardCommunication",
		"显示板通讯",
		"",
		"显示板通讯：0-正常，1-故障",
		0,
		0,
		"故障",
		"",
		0,
		0
	},
	{
		OCTSTR,
		0,
		READONLY,
		"PCFault",
		"与PC机故障",
		"",
		"与PC机故障：0-正常，1-故障",
		0,
		0,
		"故障",
		"",
		0,
		0
	},
	{
		OCTSTR,
		0,
		READONLY,
		"FireLineAndZeroLineReverse",
		"火线与零线反接故障",
		"",
		"火线与零线反接故障：0-正常，1-故障",
		0,
		0,
		"故障",
		"",
		0,
		0
	},
	{
		INTEGER,
		0,
		READONLY,
		"CoilTemperature1",
		"盘管温度1",
		"℃",
		"盘管温度1：范围-127~127℃",
		0,
		0,
		"盘管温度1过高",
		"盘管温度1过低",
		0,
		0
	},
	{
		INTEGER,
		0,
		READONLY,
		"CoilTemperature2",
		"盘管温度2",
		"℃",
		"盘管温度2：范围-127~127℃",
		0,
		0,
		"盘管温度2过高",
		"盘管温度2过低",
		0,
		0
	},
	{
		INTEGER,
		0,
		READONLY,
		"CoilTemperature3",
		"盘管温度3",
		"℃",
		"盘管温度3：范围-127~127℃",
		0,
		0,
		"盘管温度3过高",
		"盘管温度3过低",
		0,
		0
	},
	{
		INTEGER,
		0,
		READONLY,
		"CoilTemperature4",
		"盘管温度4",
		"℃",
		"盘管温度4：范围-127~127℃",
		0,
		0,
		"盘管温度4过高",
		"盘管温度4过低",
		0,
		0
	},
	{
		BOOLEAN,
		0,
		READWRITE,
		"Reserve",
		"预留",
		"",
		"预留",
		0,
		0,
		"",
		"",
		0,
		0
	}
};


/**********************************************************************************************************
* 函数名称： static void cmd_fun(short index, int addr, void *data, char *cmd, short *len)
* 函数说明： 生成获取传感器数据指令
* 输入参数： 指令索引，传感器地址，变量结构体指针,以及指令缓存区指针,指令长度
* 返回参数： 无
**********************************************************************************************************/
static void cmd_fun(short index, int addr, void *data, char *cmd, short *len)
{
	short temp;
	Data_Struct 	*d = (Data_Struct*)data;
	if(d->TimingSetting.value.inum>24)		d->TimingSetting.value.inum		 = 24;
	if(d->TimingSetting.value.inum<0)		d->TimingSetting.value.inum		 = 0;	
	if(d->TemperatureSetting.value.fnum>65) d->TemperatureSetting.value.fnum = 65.0;
	if(d->TemperatureSetting.value.fnum<10) d->TemperatureSetting.value.fnum = 10.0;
	if(d->HumiditySetting.value.fnum>99)	d->HumiditySetting.value.fnum	 = 99.0;
	if(d->HumiditySetting.value.fnum<10)	d->HumiditySetting.value.fnum	 = 10.0;	
	switch(index)
	{
		case 0:
			cmd[0] = addr;
			cmd[1] = 0x03;
			cmd[2] = 0xFC;
			cmd[3] = 0x00;
			cmd[4] = 0x00;
			cmd[5] = 0x0C;
			*len = CRC16_Padding(cmd, 6);
			break;
		case 1:
			if(d->OnOff.status==NewSet){
				cmd[0] = addr;
				cmd[1] = 0x06;
				cmd[2] = 0xFC;
				cmd[3] = 0x00;
				if(d->OnOff.value.inum){
					cmd[4] = 0xFF;
					cmd[5] = 0x00;
				}
				else{
					cmd[4] = 0x00;
					cmd[5] = 0xFF;					
				}				
				*len = CRC16_Padding(cmd, 6);
			}
			else{
				*len  = -1;
			}
			break;
		case 2:
			if(d->TimingSetting.status==NewSet){
				temp = (short)(d->TimingSetting.value.inum);
				cmd[0] = addr;
				cmd[1] = 0x06;
				cmd[2] = 0xFC;
				cmd[3] = 0x01;
				cmd[4] = temp>>8;
				cmd[5] = temp&0x00FF;
				*len = CRC16_Padding(cmd, 6);
			}
			else{
				*len  = -1;
			}
			break;	
		case 3:
			if(d->TemperatureSetting.status==NewSet){
				temp = (short)(d->TemperatureSetting.value.fnum*10);
				cmd[0] = addr;
				cmd[1] = 0x06;
				cmd[2] = 0xFC;
				cmd[3] = 0x02;
				cmd[4] = temp>>8;
				cmd[5] = temp&0x00FF;
				*len = CRC16_Padding(cmd, 6);
			}
			else{
				*len  = -1;
			}
			break;				
		case 4:
			if(d->HumiditySetting.status==NewSet){
				temp = (short)(d->HumiditySetting.value.fnum*10);
				cmd[0] = addr;
				cmd[1] = 0x06;
				cmd[2] = 0xFC;
				cmd[3] = 0x03;
				cmd[4] = temp>>8;
				cmd[5] = temp&0x00FF;
				*len = CRC16_Padding(cmd, 6);
			}
			else{
				*len  = -1;
			}
			break;		
		default:
			break;
	}
}


/**********************************************************************************************************
* 函数名称： static int parse_fun(short index, int addr, void *data, char *buf, short len)
* 函数说明： 解析传感器响应的数据，并写入数据库
* 输入参数： 解析索引,传感器地址，变量结构体指针，以及响应数据缓存取指针，响应数据长度
* 返回参数： 返回解析结果，返回0成功，返回1失败
**********************************************************************************************************/
static int parse_fun(short index, int addr, void *data, char *buf, short len)
{
	union{
		short			dat16;
     	unsigned char  	dat8[2];
   }DAT16_8;						   //数据类型转换	
	Data_Struct	*d = (Data_Struct*)data;

	if(buf!=NULL && buf[0]==addr && len>0 )
	{	
		if(CRC16_Check(buf,len))
		{
			switch(index)
			{
				case 0:
					if(d->Reserve.status==NewSet){
						d->Reserve.status						= Normal;
						d->OnOff.status							= Normal;
						d->TimingSetting.status					= Normal;
						d->TemperatureSetting.status			= Normal;
						d->HumiditySetting.status				= Normal;
					}

					if(d->OnOff.status!=NewSet){
						DAT16_8.dat8[1] = buf[3];
						DAT16_8.dat8[0] = buf[4];
						d->OnOff.value.inum						= (unsigned short)DAT16_8.dat16==0xFF00?1:0;
						if((unsigned short)DAT16_8.dat16==0xFF00) Set_Var_Status(&d->OnOff,ON, "开机");
						else									  Set_Var_Status(&d->OnOff,OFF,"关机");					
					}
					if(d->TimingSetting.status!=NewSet){
						DAT16_8.dat8[1] = buf[5];
						DAT16_8.dat8[0] = buf[6];
						d->TimingSetting.value.inum				= DAT16_8.dat16;		
					}
					if(d->TemperatureSetting.status!=NewSet){
						DAT16_8.dat8[1] = buf[7];
						DAT16_8.dat8[0] = buf[8];
						d->TemperatureSetting.value.fnum		= DAT16_8.dat16*0.1;	
					}
					if(d->HumiditySetting.status!=NewSet){
						DAT16_8.dat8[1] = buf[9];
						DAT16_8.dat8[0] = buf[10];
						d->HumiditySetting.value.fnum			= DAT16_8.dat16*0.1;	
					}						
					DAT16_8.dat8[1] = buf[11];
					DAT16_8.dat8[0] = buf[12];
					d->RoomTemperature.value.inum				= DAT16_8.dat16;
					DAT16_8.dat8[1] = buf[13];
					DAT16_8.dat8[0] = buf[14];
					d->RoomHumidity.value.fnum					= DAT16_8.dat16*0.1;
					
					DAT16_8.dat8[1] = buf[15];
					DAT16_8.dat8[0] = buf[16];					
					d->Fan.value.str							= DAT16_8.dat16&0x0001?"开":"关";
					Set_Var_Status(&d->Fan,						  DAT16_8.dat16&0x0001?ON:OFF, NULL);
					d->Compressor1.value.str					= DAT16_8.dat16&0x0002?"开":"关";
					Set_Var_Status(&d->Compressor1,				  DAT16_8.dat16&0x0002?ON:OFF, NULL);
					d->Compressor2.value.str					= DAT16_8.dat16&0x0004?"开":"关";
					Set_Var_Status(&d->Compressor2,				  DAT16_8.dat16&0x0004?ON:OFF, NULL);
					d->ElectricHeater.value.str					= DAT16_8.dat16&0x0008?"开":"关";
					Set_Var_Status(&d->ElectricHeater,			  DAT16_8.dat16&0x0008?ON:OFF, NULL);
					d->LowFan.value.str							= DAT16_8.dat16&0x0010?"开":"关";
					Set_Var_Status(&d->LowFan,					  DAT16_8.dat16&0x0010?ON:OFF, NULL);
					d->HumidityControl.value.str				= DAT16_8.dat16&0x0020?"开":"关";
					Set_Var_Status(&d->HumidityControl,			  DAT16_8.dat16&0x0020?ON:OFF, NULL);
					d->Defrost.value.str						= DAT16_8.dat16&0x0040?"开":"关";
					Set_Var_Status(&d->Defrost,					  DAT16_8.dat16&0x0040?ON:OFF, NULL);
					d->Protect.value.str						= DAT16_8.dat16&0x0080?"开":"关";
					Set_Var_Status(&d->Protect,					  DAT16_8.dat16&0x0080?ON:OFF, NULL);

					DAT16_8.dat8[1] = buf[17];
					DAT16_8.dat8[0] = buf[18];	
					d->DefrostSensor2.value.str					= DAT16_8.dat16&0x0100?"故障":"正常";
					Set_Var_Status(&d->DefrostSensor2,			  DAT16_8.dat16&0x0100?Alarm:Normal, NULL);
					d->HumiditySensor.value.str					= DAT16_8.dat16&0x0200?"故障":"正常";
					Set_Var_Status(&d->HumiditySensor,			  DAT16_8.dat16&0x0200?Alarm:Normal, NULL);
					d->DefrostSensor1.value.str					= DAT16_8.dat16&0x0400?"故障":"正常";
					Set_Var_Status(&d->DefrostSensor1,			  DAT16_8.dat16&0x0400?Alarm:Normal, NULL);					
					d->PhaseSequenceFault.value.str				= DAT16_8.dat16&0x0800?"故障":"正常";
					Set_Var_Status(&d->PhaseSequenceFault,		  DAT16_8.dat16&0x0800?Alarm:Normal, NULL);
					d->RoomTemperatureSensor.value.str			= DAT16_8.dat16&0x1000?"故障":"正常";
					Set_Var_Status(&d->RoomTemperatureSensor,	  DAT16_8.dat16&0x1000?Alarm:Normal, NULL);
					d->SystemHighPressureSensor.value.str		= DAT16_8.dat16&0x2000?"故障":"正常";
					Set_Var_Status(&d->SystemHighPressureSensor,  DAT16_8.dat16&0x2000?Alarm:Normal, NULL);
					d->SystemLowPressureSensor.value.str		= DAT16_8.dat16&0x4000?"故障":"正常";
					Set_Var_Status(&d->SystemLowPressureSensor,	  DAT16_8.dat16&0x4000?Alarm:Normal, NULL);
					d->FullWaterFault.value.str					= DAT16_8.dat16&0x8000?"故障":"正常";
					Set_Var_Status(&d->FullWaterFault,			  DAT16_8.dat16&0x8000?Alarm:Normal, NULL);
					d->CompressorOverCurrentFault.value.str		= DAT16_8.dat16&0x0001?"故障":"正常";
					Set_Var_Status(&d->CompressorOverCurrentFault,DAT16_8.dat16&0x0001?Alarm:Normal, NULL);
					d->FanOverCurrentFault.value.str			= DAT16_8.dat16&0x0002?"故障":"正常";
					Set_Var_Status(&d->FanOverCurrentFault,		  DAT16_8.dat16&0x0002?Alarm:Normal, NULL);
					d->DefrostSensor3.value.str					= DAT16_8.dat16&0x0004?"故障":"正常";
					Set_Var_Status(&d->DefrostSensor3,			  DAT16_8.dat16&0x0004?Alarm:Normal, NULL);
					d->DefrostSensor4.value.str					= DAT16_8.dat16&0x0008?"故障":"正常";
					Set_Var_Status(&d->DefrostSensor4,			  DAT16_8.dat16&0x0008?Alarm:Normal, NULL);					
					d->DisplayBoardCommunication.value.str		= DAT16_8.dat16&0x0010?"故障":"正常";
					Set_Var_Status(&d->DisplayBoardCommunication, DAT16_8.dat16&0x0010?Alarm:Normal, NULL);
					d->PCFault.value.str						= DAT16_8.dat16&0x0020?"故障":"正常";
					Set_Var_Status(&d->PCFault,					  DAT16_8.dat16&0x0020?Alarm:Normal, NULL);
					d->FireLineAndZeroLineReverse.value.str		= DAT16_8.dat16&0x0040?"故障":"正常";
					Set_Var_Status(&d->FireLineAndZeroLineReverse,DAT16_8.dat16&0x0040?Alarm:Normal, NULL);

					DAT16_8.dat8[1] = buf[19];
					DAT16_8.dat8[0] = buf[20];
					d->CoilTemperature1.value.inum				= DAT16_8.dat16;
					if(DAT16_8.dat16==0x0080) Set_Var_Status(&d->CoilTemperature1,	OFF, "未启用");	
					DAT16_8.dat8[1] = buf[21];
					DAT16_8.dat8[0] = buf[22];
					d->CoilTemperature2.value.inum				= DAT16_8.dat16;
					if(DAT16_8.dat16==0x0080) Set_Var_Status(&d->CoilTemperature2,	OFF, "未启用");	
					DAT16_8.dat8[1] = buf[23];
					DAT16_8.dat8[0] = buf[24];
					d->CoilTemperature3.value.inum				= DAT16_8.dat16;
					if(DAT16_8.dat16==0x0080) Set_Var_Status(&d->CoilTemperature3,	OFF, "未启用");	
					DAT16_8.dat8[1] = buf[25];
					DAT16_8.dat8[0] = buf[26];
					d->CoilTemperature4.value.inum				= DAT16_8.dat16;
					if(DAT16_8.dat16==0x0080) Set_Var_Status(&d->CoilTemperature4,	OFF, "未启用");	
					break;
				case 1:
					if((unsigned char)buf[2]==0xFC&&buf[3]==0x00){
						d->OnOff.status							= Normal;
					}
					break;				
				case 2:	
					if((unsigned char)buf[2]==0xFC&&buf[3]==0x01){
						d->TimingSetting.status					= Normal;
					}
					break;				
				case 3:	
					if((unsigned char)buf[2]==0xFC&&buf[3]==0x02){
						d->HumiditySetting.status				= Normal;
					}
					break;	
				case 4:	
					if((unsigned char)buf[2]==0xFC&&buf[3]==0x03){
						d->HumiditySetting.status				= Normal;
					}
					break;
				default:
					break;
			}
			return 0;
		}
	}
	return 1;
}


/**********************************************************************************************************
* 函数名称： void other_CF12SD_Registration(void)
* 函数说明： 除湿机驱动注册
* 输入参数： 无
* 返回参数： 无
**********************************************************************************************************/
void other_CF12SD_Registration(void)
{
	DeviceDriverRegistration(
		"other",												//设备类型
		"除湿机",												//设备名称（导航栏默认显示名称）
		"百奥",													//设备品牌
		"CF12SD",												//设备型号
		"适用于百奥工商用除湿机",								//驱动描述
		var_attr,												//变量属性声明
		sizeof(Data_Struct),									//变量结构体空间大小
		cmd_fun,												//发送指令生成函数
		parse_fun,												//数据解析函数
		500														//设备响应超时时间
	);
		
#if 0
	#define CMD1 "\x01\x03\xFC\x00\x00\x0C\x75\x9F"
	#define RSP1 "\x01\x03\x18\xFF\x00\x00\x00\x00\xFA\x00\xFF\x01\x5E\x02\x2B\x5A\x5A\x5A\x5A\x5A\xFF\x00\xFF\x00\xFF\x00\xFF\x4B\x95"	
	#define CMD2 "\x01\x06\xFC\x00\x00\x00\xB9\x9A"
	#define RSP2 "\x01\x06\xFC\x00\x00\x00\xB9\x9A"		
	#define CMD3 "\x01\x06\xFC\x01\x00\x00\xE8\x5A"
	#define RSP3 "\x01\x06\xFC\x01\x00\x00\xE8\x5A"		
	#define CMD4 "\x01\x06\xFC\x02\x00\x00\x18\x5A"
	#define RSP4 "\x01\x06\xFC\x02\x00\x00\x18\x5A"		
	VirtualFrameRegistration(CMD1, sizeof(CMD1)-1, RSP1, sizeof(RSP1)-1);		
	VirtualFrameRegistration(CMD2, sizeof(CMD2)-1, RSP2, sizeof(RSP2)-1);		
	VirtualFrameRegistration(CMD3, sizeof(CMD3)-1, RSP3, sizeof(RSP3)-1);	
	VirtualFrameRegistration(CMD4, sizeof(CMD4)-1, RSP4, sizeof(RSP4)-1);		
#endif
}

